﻿using etracks.EntityModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web.Mvc;

namespace etracks.Helpers
{
    /// <summary>
    /// Extensions for the following types:
    /// String
    /// ControllerBase 
    /// </summary>

    public static class StringExtensions
    {
        public static int WordCount(this String str)
        {
            return str.Split(new char[] { ' ', '.', '?' },
                             StringSplitOptions.RemoveEmptyEntries).Length;
        }
    }

    public static class ControllerExtensions
    {
        public static void SuccessAlert(this ControllerBase c, string message)
        {
            c.TempData.Add("bootstrap_alert", BootstrapAlert.Success(message));
            //c.ViewData.Add("bootstrap_alert", BootstrapAlert.Success(message));
            //c.ViewBag.Alert = BootstrapAlert.Success(message);
        }
    }
}
